﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace WindowsTheme.Helper
{
    class Win7Create
    {
        public static void ThemeCreate(String ThemePath,String ThemeName)
        {
            FileHelper.Folder_existence(ThemePath,true);
         
            String CreateTheme = ThemePath + ThemeName + ".theme";
            string XmlPath = ThemePath + "ThemeInfo.xml";
            if (!File.Exists(CreateTheme))
            {
                String FileText = Resource1.Win7defaultMod;
                FileText = FileText.Replace("CatReplaceFlag", ThemeName);
                PrintLog.Log("已创建："+ThemePath + ThemeName + ".theme");
                File.WriteAllText(CreateTheme, FileText, Encoding.ASCII);
            }
            else {
                PrintLog.Log( "主题文件已存在，无需重新创建");
            }
            if(!File.Exists(XmlPath))
            XmlHelper.SaveXml(Resource1.UserInfoXml, XmlPath);
            else
            {
                PrintLog.Log("xml文件已存在，无需重新创建");
            }
        }
    }
}
